<?php

if(!defined('INC_PATH')){
	define("INC_PATH","../../../");
}
require_once(INC_PATH."lib_new/db.php");
if($_GET["debug"])echo CONNECTION_STRING;
$sql_check = "select coalesce(max(num),0) as num,coalesce(max(num2),0) as num2 from smd_takarakuji_ctrl where id>1  and regist_date >= date_trunc('month',now());";
$con = con_open();
$res_check = pg_query($con, $sql_check);
if(!$res_check){
	echo '
Var.set(d_flag,1);
Var.set(y_flag,1);
';
con_close($con);
exit;
}
con_close($con);
$num = pg_fetch_result($res_check, "num");
$num2 = pg_fetch_result($res_check, "num2");

echo '
Var.set(d_flag,'.$num.');
Var.set(y_flag,'.$num2.');
';
?>